package com.fancy.learncenter.ui.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;

import com.fancy.learncenter.R;
import com.fancy.learncenter.bean.BaseBean;
import com.fancy.learncenter.bean.SetNameDataBean;
import com.fancy.learncenter.net.CustomNetCallBack;
import com.fancy.learncenter.net.CustomNetSubscriber;
import com.fancy.learncenter.net.HttpMehtod;
import com.fancy.learncenter.ui.activity.base.BaseActivity;
import com.fancy.learncenter.ui.adapter.FragPagerAdapter;
import com.fancy.learncenter.ui.fragment.CollectionActivityFragment;
import com.fancy.learncenter.ui.fragment.CollectionArtFragment;
import com.fancy.learncenter.ui.fragment.CollectionGoodsFragment;
import com.fancy.learncenter.ui.fragment.LocationAuidoFragment;
import com.fancy.learncenter.utils.NetUtil;
import com.fancy.learncenter.utils.ToastUtil;
import com.fancy.learncenter.utils.Utils;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import okhttp3.ResponseBody;
import retrofit2.Response;

import static com.fancy.learncenter.utils.NetUtil.*;

public class MyCollectionActivity extends BaseActivity {

    @Bind(R.id.tab_layout)
    TabLayout tabLayout;
    @Bind(R.id.view_pager)
    ViewPager viewPager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_recorder_audio, Status.STATUS, "我的收藏");
        ButterKnife.bind(this);
        initViewPager();

    }

    private void initViewPager() {
        List<Fragment> fragments = new ArrayList<>();
        fragments.add(new CollectionActivityFragment());
        fragments.add(new CollectionGoodsFragment());
        fragments.add(new CollectionArtFragment());

        List titles = new ArrayList();
        titles.add("活动");
        titles.add("商品");
        titles.add("文章");
        FragPagerAdapter mFragmentAdapteradapter =
                new FragPagerAdapter(getSupportFragmentManager(), fragments, titles);
        //给ViewPager设置适配器
        viewPager.setAdapter(mFragmentAdapteradapter);

        tabLayout.setTabMode(TabLayout.MODE_FIXED);
        //为TabLayout添加tab名称
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.addTab(tabLayout.newTab());
        tabLayout.setupWithViewPager(viewPager);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ButterKnife.unbind(this);
    }

}
